<!--
 * @Descripttion:
 * @version:
 * @Author: zhuzm@linkstec.com
 * @Date: 2023-01-31 13:28:55
 * @LastEditors: sueRimn
 * @LastEditTime: 2023-03-21 17:08:59
-->
<template>
  <div class="search-list-product">
    <div class="list-item" v-for="(item, index) in dataFilter" :key="index" @click="jump(item)">
      <div class="code" v-html="`(${item.detail.id_index})`"></div>
      <h2 class="name" v-html="item.detail.full_name_v"></h2>
    </div>
  </div>
</template>
<script>
import { verifyRoles } from '@/utils/verify';
export default {
  props: {
    data: {
      type: Array,
      default: () => {
        return [];
      }
    },
    max: {
      type: Number,
      default: Infinity
    }
  },
  computed: {
    dataFilter () {
      if (this.max === Infinity) return this.data;
      return this.data.slice(0, this.max);
    }
  },
  methods: {
    jump (item) {
      // eslint-disable-next-line no-unused-vars
      const result = verifyRoles('TGFW', 0);
      const url = process.env.VUE_APP_SERVICE_TZGW_BOND + '?bond=' + item.detail.id_index;
      this.newgetTZGWJump(url);
    },
    newgetTZGWJump (url) {
      window.location.href = process.env.VUE_APP_SERVICE_TZGW_NEW + '/' + encodeURIComponent(url);
    }
  }
};
</script>
<style lang="scss" scoped>
@import './common.scss';
.search-list-product{
  .list-item{
    margin-bottom: 11px;
    display: flex;
    cursor: pointer;
    .code{
      font-family: 'Source Han Sans CN';
      font-style: normal;
      font-weight: 400;
      font-size: 14px;
      line-height: 21px;
      color: #333333;
      margin-right: 8px;
    }
  }
}
</style>
